import lidar as lidar

# 使用示例
if __name__ == "__main__":
    # 定义目标区域A（复杂多边形）
    area_A = [(0, 0), (10, 0), (10, 10),  (0, 10),(5, 5), (0, 5), (5, 0)]
    
    # 设置雷达位置（可尝试不同位置）
    radar_position = (2, 4)  # 区域内部
    # 初始化扫描器
    scanner = lidar.RadarScanner(area_A, radar_position, angular_res=2)
     # 执行扫描并可视化
    for i in range(0, 360, 1):
        angles = [i]
        scan_results = scanner.scan_at_angles(angles)
        for res in scan_results:
            print(f"角度: {res['angle']}°, 距离: {res['distance']:.2f}, 交点: ({res['point'][0]:.2f}, {res['point'][1]:.2f})")
        
